Repository navigation
Handle zero and infinite argument pairs in atan2 - #1439
agourakis82 wants to merge 1 commit into
Conversation
|
Published in a5a3d83. I integrated the regression cases into the existing typed function tests. The atan2 block now runs the eight finite sample pairs with explicit numerical assertions in both strict and fast-math. The signed-zero and infinity/NaN cases retain narrow strict guards, matching the implementation's exceptional-input contract. The complex log zero-angle cases now live in the existing On macOS ARM64 with Apple Clang 21 and C++23, the expanded scoped tests pass all twelve cases in each mode, with 648 assertions in strict mode and 48 in fast-math. Removing the final atan2 zero-pair correction in a receipt-local header copy causes 36 assertions to fail in strict mode. A separate mutation restricted to the shared finite pairs causes all 48 finite assertions to fail in both modes, confirming that the shared numerical coverage executes. Prepared with OpenAI Codex assistance. |
Avoid 0/0 and inf/inf ratios, and keep the signed angle for a pair of zeros.
a5a3d83 to
24b0cc5
Compare
|
Superseded by #1456 |
atan2(0, 0)andatan2(inf, inf)divided those pairs and returned NaN, and a pair of zeros lost the signed angle. The non-fast-math path substitutes a unit ratio for those pairs and restorescopysign(0 or pi, y)when both arguments are zero. The test crosses two vectors of eight values, including signed zeros and infinities, and compares each batch withstd::atan2. Under fast-math, where that recovery is compiled out, the same grid uses finite non-zero stand-ins.Part of #1432.
Written by me with AI assistance.